<?php

namespace App\CLI;

use Forxx\console\CLIRunner;
use Forxx\console\CConsole;
use Lavender\Router;

class CRoute extends CLIRunner{
	
	public function test_action()
	{
        $verb = CConsole::prompt("input the verb: ",'get');
        $url = CConsole::prompt('input the uri : ','/index.php');
        $ret = Router::check($url,$verb);
        if($ret)
        {
            CConsole::print_line("Passed! Module is '".Router::getModule()."' Action is '".Router::getAction()."'!");
        }
        else 
        {
            CConsole::print_line("Can't Pass!");
        }
        return;
	}
	
	public function compiled_action()
	{
	    $rules = Router::getRules(L_APP_PATH."conf/route_rules.php");
	    $content = var_export($rules,true);
		file_put_contents(L_APP_PATH."conf/route_compiled.php", '<?php return '.$content.";");

	}

}